package day1.HomeWork;

public class Test6 {
    public static boolean isEqual(int a, int b){
        if(a==b){
            return true;
        }else {
            return false;
        }
    }
    public static boolean isEqual(double a, double b){
        if(a==b){
            return true;
        }else {
            return false;
        }
    }

    public static boolean isEqual(Object a, Object b){
        if (!(a.getClass().isInstance(b))) {
            return false;
        }
        // 使用equals()方法比较引用类型
        return a.equals(b);
    }
    public static void main(String[] args) {
        //测试基本数据类型
        System.out.println(isEqual(10, 20));
        isEqual(20, 20);
        //测试引用数据类型
        String s1 = "hello";
        String s2 = "hello";
        System.out.println(isEqual(s1, s2));
    }
}
